# Include headers
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/tools/SparseSolver/)

# Enumerate source files
FILE(GLOB TEST_SRC_FILES unit_test_driver.cpp)
FILE(GLOB TEST_INC_FILES *Test.h)

# Generate third party definitions.
SET(DEPENDENT_DEFINITIONS "")
IF (UMFPACK_FOUND)
    LIST(APPEND DEPENDENT_DEFINITIONS -DWITH_UMFPACK)
ENDIF (UMFPACK_FOUND)

IF (CHOLMOD_FOUND)
    LIST(APPEND DEPENDENT_DEFINITIONS -DWITH_CHOLMOD)
ENDIF (CHOLMOD_FOUND)

IF (METIS_FOUND)
    LIST(APPEND DEPENDENT_DEFINITIONS -DWITH_METIS)
ENDIF (METIS_FOUND)

IF (MKL_FOUND)
    LIST(APPEND DEPENDENT_DEFINITIONS -DWITH_MKL)
ENDIF (MKL_FOUND)

ADD_EXECUTABLE(SparseSolver_tests ${TEST_SRC_FILES} ${TEST_INC_FILES})
TARGET_LINK_LIBRARIES(SparseSolver_tests Mesh lib_SparseSolver
    ${GTEST_BOTH_LIBRARIES})
TARGET_COMPILE_DEFINITIONS(SparseSolver_tests PRIVATE ${DEPENDENT_DEFINITIONS})
ADD_CUSTOM_COMMAND(TARGET SparseSolver_tests POST_BUILD COMMAND SparseSolver_tests)
